'''
python的re模块正则表达式
'''

import re

# s = "1python itheima"
# match 从头匹配
# result = re.match("python",s)
# print(result)
# print(result.span())
# print(result.group())

# s = '1python666itheima666python666'
# result2 = re.search("python",s)
# print(result2)

# findall 搜索全部匹配
# result3 = re.findall("python",s)
# print(result3)



# 正则表达式元字符匹配
s = "itheima @@python2 !!666 ##itcast3"

# 字符串前面带上r的标记，表示字符串中转移字符无效，就是普通字符的意思
# \d 匹配数字，即0-9
result = re.findall(r'\d', s)
print(result)
# \W 匹配非单词字符
result1 = re.findall(r'\W', s)
print(result1)
# []，匹配[]中列举的字符
result2 = re.findall(r'[a-zA-Z]', s)
print(result2)